<?php

namespace App\Service\User;


use App\Dao\User\UserSpreadSettingDao;
use App\Service\BaseService;
use Hyperf\Di\Annotation\Inject;

/**
 * @Notes:【】
 * @Date: 2022-11-26 0:51
 */
class UserSpreadSettingService extends BaseService
{
    /**
     * @Inject()
     * @var UserSpreadSettingDao
     */
    protected $userSpreadSettingDao;

    public function lists($params)
    {
        $data = $this->userSpreadSettingDao->lists($params);
        return $data;
    }

    public function add(\App\Tool\Collect $params)
    {
        $this->userSpreadSettingDao->isExistPeople($params->get('people'), $params->get('id', 0)) && _Error('people 重复');
        return $this->userSpreadSettingDao->create($params->toArray());
    }

    public function edit($id, \App\Tool\Collect|\Hyperf\Utils\Collection $params)
    {
        $this->userSpreadSettingDao->isExistPeople($params->get('people'), $id) && _Error('people 重复');
        return $this->userSpreadSettingDao->edit($id, $params);
    }

    public function del(mixed $id)
    {
        return $this->userSpreadSettingDao->del($id);
    }


}